﻿using IterationLife.Educations.Models;
using Util;
using Util.Maps;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.Educations {
    /// <summary>
    /// 能力标准数据传输对象扩展
    /// </summary>
    public static class AbilityStandardDtoExtension {
        /// <summary>
        /// 转换为能力标准实体
        /// </summary>
        /// <param name="dto">能力标准数据传输对象</param>
        public static AbilityStandard ToEntity( this AbilityStandardDto dto ) {
            if ( dto == null )
                return new AbilityStandard();
            return dto.MapTo( new AbilityStandard( dto.Id.ToGuid() ) );
        }
        
        /// <summary>
        /// 转换为能力标准数据传输对象
        /// </summary>
        /// <param name="entity">能力标准实体</param>
        public static AbilityStandardDto ToDto(this AbilityStandard entity) {
            if( entity == null )
                return new AbilityStandardDto();
            return entity.MapTo(new AbilityStandardDto());
        }
    }
}
